clear 

set maxvar 32767

global out "$dat"
global dir "$dat"

cd $out

do IND2015ER.do


use ${out}ind6813.dta, clear
save ${out}ind2015er , replace
erase ${out}ind6813.dta

forvalues y=1997(2)2015 {

do FAM`y'ER

if `y'<2000 local stub=`y'-1900
else if `y'>=2000 local stub=`y'-2000

if `y'<2000 {
	use ${out}f`stub'.dta, clear
	save ${out}FAM19`stub', replace
	erase ${out}f`stub'.dta
}	
	
else if `y'>=2000 & `y'<2010{
	use ${out}f0`stub'.dta, clear
	save ${out}FAM200`stub' , replace
	erase ${out}f0`stub'.dta
}

else if `y'>=2010 {
	use ${out}f`stub'.dta, clear
	save ${out}FAM20`stub' , replace
	erase ${out}f`stub'.dta
}

}
*



